#include "ai-speech-recognition.h"
#include "baidu-ai-asr.h"
int main(int argc, char const *argv[])
{
#if 1
    AISpeechRecognition ai("plughw:1,0");
    ai.start();
    // 进程挂起
    while (1)
    {
        pause();
    }

#endif

#if 0
    BaiduAiAsr basr("jE6Zt83Db5iTHm78PIAi4HUY", "jox6o5Vo5xkx0yypNWHRcdhosNio5IET");
    string token = basr.getAccessToken();
    cout << token << endl;
// 语音文件识别为文字
    FILE *fp = fopen("16k.pcm", "r");
    fseek(fp, 0, SEEK_END);
    uint32_t fileSize = ftell(fp);
    rewind(fp);
    vector<uint8_t> audio(fileSize);
    fread(audio.data(), audio.size(), 1, fp);
    fclose(fp);
    cout << basr.asrAudioData(token, audio) << endl;
#endif

    return 0;
}
